var app = angular.module("inorbit", [ 'ngRoute', 'firebase' ]);

app.config(function($routeProvider) {
	$routeProvider.when('/form', {
		templateUrl : 'form.html',
		controller : 'fromController'
	});
	$routeProvider.when('/search', {
		templateUrl : 'list.html',
		controller : 'listController'
	});
	$routeProvider.otherwise({
		redirectTo : '/form'
	});
});

app.controller('fromController', [ '$scope', function($scope) {
	$scope.source = 'Pune';
	$scope.destination = 'Mumbai';
} ]);

app.controller('listController', [ '$scope', '$routeParams', '$firebase',
		function($scope, $routeParams, $firebase) {
			var ref = new Firebase("https://sumitteke.firebaseio.com/");
			$scope.cabs = $firebase(ref);
			$scope.source = $routeParams.source;
			$scope.destination = $routeParams.destination;
		} ]);